stylecontext: add gtk_render_icon()
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 25 May 2011 00:59:50 +0000 (20:59 -0400)
committerBenjamin Otte <otte@redhat.com>
Thu, 9 Jun 2011 21:17:09 +0000 (23:17 +0200)
docs/reference/gtk/gtk3-sections.txt
gtk/gtk.symbols
gtk/gtkstylecontext.c
gtk/gtkstylecontext.h

index a84c0b34e8401ada80fc832f2cb19bb58eec0b66..72c1a6f2aaec1b031b2b402b74fbf9b3bf0b334d 100644 (file)
@@ -5642,6 +5642,7 @@ gtk_render_option
 gtk_render_slider
 gtk_render_activity
 gtk_render_icon_pixbuf
+gtk_render_icon
 
 <SUBSECTION Standard>
 GTK_TYPE_STYLE_CONTEXT
index 3f15bf5218d6b44944a16660547a2dbc0adc9ca7..c6def71be019380c760f8ae1701133f3f4f0cfac 100644 (file)
@@ -2230,6 +2230,7 @@ gtk_render_focus
 gtk_render_frame
 gtk_render_frame_gap
 gtk_render_handle
+gtk_render_icon
 gtk_render_icon_pixbuf
 gtk_render_layout
 gtk_render_line
index 9810ddd28d2b7be885f2f17be856ae4c153cb6b3..aad8e222487e11314bf751305ce5fe265fd67c06 100644 (file)
@@ -4366,3 +4366,44 @@ gtk_render_icon_pixbuf (GtkStyleContext     *context,
   _gtk_theming_engine_set_context (priv->theming_engine, context);
   return engine_class->render_icon_pixbuf (priv->theming_engine, source, size);
 }
+
+/**
+ * gtk_render_icon:
+ * @context: a #GtkStyleContext
+ * @cr: a #cairo_t
+ * @pixbuf: a #GdkPixbuf containing the icon to draw
+ * @x: X position for the @pixbuf
+ * @y: Y position for the @pixbuf
+ *
+ * Renders the icon in @pixbuf at the specified @x and @y coordinates.
+ *
+ * Since: 3.2
+ **/
+void
+gtk_render_icon (GtkStyleContext *context,
+                 cairo_t         *cr,
+                GdkPixbuf       *pixbuf,
+                 gdouble          x,
+                 gdouble          y)
+{
+  GtkStyleContextPrivate *priv;
+  GtkThemingEngineClass *engine_class;
+
+  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+  g_return_if_fail (cr != NULL);
+
+  priv = context->priv;
+  engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
+
+  cairo_save (cr);
+
+  store_animation_region (context,
+                          x, y,
+                          gdk_pixbuf_get_width (pixbuf),
+                          gdk_pixbuf_get_height (pixbuf));
+
+  _gtk_theming_engine_set_context (priv->theming_engine, context);
+  engine_class->render_icon (priv->theming_engine, cr, pixbuf, x, y);
+
+  cairo_restore (cr);  
+}
index e687ff13e477ca565b400d007a1e3bfc5ff67371..1a29c5174c2f361ca034839ffa777ae35f4571db 100644 (file)
@@ -745,6 +745,11 @@ void        gtk_render_activity    (GtkStyleContext     *context,
 GdkPixbuf * gtk_render_icon_pixbuf (GtkStyleContext     *context,
                                     const GtkIconSource *source,
                                     GtkIconSize          size);
+void        gtk_render_icon        (GtkStyleContext     *context,
+                                    cairo_t             *cr,
+                                   GdkPixbuf           *pixbuf,
+                                    gdouble              x,
+                                    gdouble              y);
 
 G_END_DECLS